home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Freesoft 1997 May
/
Freesoft_1997-05_cd.bin
/
inzer
/
minolta
/
drivers
/
WL400
/
W3.1 disk 1
/
TESTPAGE.MS_
/
TESTPAGE.MS
Wrap
Text File
|
1994-12-06
|
10KB
|
330 lines
ON ERROR GOTO QUIT
CONST LOGO = 1
CONST ASKQUIT = 200
CONST INSTALL_TEST = 2700
CONST EXPLAIN_PAGE = 3000
CONST EXITFAILURE = 400
CONST EXITSUCCESS = 700
CONST APPHELP = 900
CONST CONTROLS = 2500
CONST CONTROLS_EGA = 2501
CONST HELP_TESTPAGE = 5600
CONST HELP_EXPLAIN_PAGE = 6100
CONST HELP_EXITFAILURE = 6200
CONST HELP_EXITSUCCESS = 7000
CONST HELP_ASKQUIT = 7200
CONST cbSymValMax = 512
CONST STFERR = 1024
CONST STFQUIT = 1025
CONST WM_SYSCOMMAND% = 274
CONST SC_MAXIMIZE% = 61488
CONST FALSE = 0
CONST TRUE = 1
CONST BTN_NO$ = "No"
CONST BTN_YES$ = "Yes"
CONST BTN_CANCEL$ = "Cancel"
CONST BTN_EXIT$ = "Exit"
CONST BTN_OK$ = "OK"
CONST BTN_PRINTAGAIN$ = "Print Again"
CONST VAL_REACTIVE$ = "REACTIVATE"
CONST BTN_EXITINSTALL$ = "Exit Install"
CONST SYM_TEMPLIST$ = "templist"
CONST DLL_CUIDLL$ = "mscuistf.dll"
CONST INI_WININI$ = "WIN.INI"
CONST INI_WINDOWS$ = "windows"
CONST INI_DEVICE$ = "device"
CONST INI_RUN$ = "run"
CONST INI_TESTPAGE$ = "testpage"
CONST SYM_BUTTONSGREYED$ = "ButtonsGreyed"
CONST SYM_RESOURCEBASENAME$ = "ResourceBaseName"
CONST VAL_STATUSPAGE$ = "statuspage"
CONST SYM_CURDLGHANDLE$ = "HDLGCUR"
CONST MSG_WPS$ = "Minolta WinLaser 400"
CONST OEM_NAME$ = "WPSLA"
CONST FILE_WPSINI$ = "wps.ini"
CONST INI_MODEL$ = "MODEL"
CONST PATH_TESTPAGE$ = "~wps_tp"
CONST PATH_WPS$ = "~ms_wps"
CONST SYM_CWDDIR$ = "STF_CWDDIR"
CONST SYM_DLGEVENT$ = "DLGEVENT"
CONST MSG_TITLE$ = "Windows Printing System"
DECLARE SUB PrintTestPage LIB "WPSLA.DRV" (a%, b%, c$)
DECLARE FUNCTION GetWindowsDirectory LIB "kernel" (szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION GetSystemDirectory LIB "kernel" (szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION CbGetListItem LIB "mscomstf.dll" (szListSymbol$, n%, szListItem$, cbMax%) AS INTEGER
DECLARE FUNCTION CbGetSymbolValue LIB "mscomstf.dll" (szSymbol$, szValue$, Length%) AS INTEGER
DECLARE FUNCTION DoMsgBox LIB "mscomstf.dll" (lpText$,lpCaption$,wType%) As INTEGER
DECLARE FUNCTION FRemoveSymbol LIB "mscomstf.dll" (szSym$) AS INTEGER
DECLARE FUNCTION UsGetListLength LIB "mscomstf.dll" (szSymbol$) AS INTEGER
DECLARE SUB FEnableControls LIB "mscuistf.dll" (a%)
DECLARE SUB FInitInfoDialog LIB "mscuistf.dll" ()
DECLARE SUB FInitMultiDialog LIB "mscuistf.dll" ()
DECLARE SUB FRemoveValFromIniKey LIB "mscuistf.dll" (a$, b$, c$, d$)
DECLARE FUNCTION CbGetIniKeyString LIB "msdetstf.dll" (szFile$, szSect$, szKey$, szBuf$, cbBuf%) AS INTEGER
DECLARE FUNCTION FDirExists LIB "msdetstf.dll" (szDir$) AS INTEGER
DECLARE FUNCTION FInitializeInstall LIB "msinsstf.dll" (hinst%, hwndFrame%) AS INTEGER
DECLARE FUNCTION FCreateIniKeyValue LIB "msinsstf.dll" (szFile$, szSect$, szKey$, szValue$, cmo%) AS INTEGER
DECLARE FUNCTION YnrcRemoveFile LIB "msinsstf.dll" (szFullPathSrc$, cmo%) AS INTEGER
DECLARE FUNCTION FSetBitmap LIB "msshlstf.dll" (szDll$, Bitmap%) AS INTEGER
DECLARE FUNCTION FSetSymbolValue LIB "msshlstf.dll" (szSymbol$, szValue$) AS INTEGER
DECLARE FUNCTION HShowWaitCursor LIB "msshlstf.dll" AS INTEGER
DECLARE FUNCTION HinstFrame LIB "msshlstf.dll" AS INTEGER
DECLARE FUNCTION HwndFrame LIB "msshlstf.dll" AS INTEGER
DECLARE FUNCTION InitializeFrame LIB "msshlstf.dll" (szCmdLine$) AS INTEGER
DECLARE FUNCTION FRestoreCursor LIB "msshlstf.dll" (hPrev%) AS INTEGER
DECLARE FUNCTION FDoDialog LIB "msuilstf.dll" (hwnd%, szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) AS INTEGER
DECLARE FUNCTION FKillNDialogs LIB "msuilstf.dll" (n%) AS INTEGER
DECLARE SUB EnableWindow LIB "user" (a%,b%)
DECLARE FUNCTION GetActiveWindow LIB "user" AS INTEGER
DECLARE FUNCTION GetDlgItem LIB "user" (a%,b%) AS INTEGER
DECLARE FUNCTION GetSystemMetrics LIB "user" (nIndex%) AS INTEGER
DECLARE FUNCTION SendMessage LIB "user" (a%,b%,c%,d$) AS INTEGER
DECLARE SUB SetWindowText LIB "user" (hwnd%, lpString$)
DECLARE SUB Box (message$, title$)
DECLARE SUB BuildPrinterName()
DECLARE SUB DeleteDir(szDir$)
DECLARE SUB DoPrintTestPage()
DECLARE SUB doASKQUIT
DECLARE SUB FCLEANUP ()
DECLARE SUB SetSymbolValue (szSymbol$, szValue$)
DECLARE SUB UIPop (n%)
DECLARE FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) AS STRING
DECLARE FUNCTION GetListItem(szSymbol$, n%) AS STRING
DECLARE FUNCTION GetListLength(szSymbol$) AS INTEGER
DECLARE FUNCTION GetSymbolValue (szSymbol$) AS STRING
DECLARE FUNCTION InitSetup (szCmdLine$) AS INTEGER
DECLARE FUNCTION UIStartDlg(szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) AS STRING
GLOBAL fFrameInit AS INTEGER
GLOBAL fInstallInit AS INTEGER
GLOBAL hSetup AS INTEGER
GLOBAL WINSYSDIR AS STRING
GLOBAL WinDir AS STRING
GLOBAL szPort$
GLOBAL iModel AS INTEGER
EntryPoint:
TRAP CleanupTrap From "MSSHLSTF.DLL"
End Trap
hSetup = InitSetup(COMMAND$)
BuildPrinterName
IF iModel = 0 THEN
GOTO CLEANUP
ENDIF
i% = SendMessage(HwndFrame(), WM_SYSCOMMAND%, SC_MAXIMIZE%, "")
SetWindowText HwndFrame(), MSG_TITLE$
IF FSetBitmap(DLL_CUIDLL$, LOGO) = 0 THEN
ERROR STFERR
END IF
dlg% = EXITFAILURE
WINSYSDIR$ = string$(256, 32)
i% = GetSystemDirectory(WINSYSDIR$, 256)
WINSYSDIR$ = WINSYSDIR$+"\"
i% = GetSystemMetrics(1)
if i% = 350 OR i% = 348 then
sz$ = UIStartDlg(DLL_CUIDLL$, CONTROLS_EGA, "FModelessDlgProc", 0, "")
else
sz$ = UIStartDlg(DLL_CUIDLL$, CONTROLS, "FModelessDlgProc", 0, "")
end if
Dlg_Install_Test:
FInitInfoDialog
sz$ = UIStartDlg(DLL_CUIDLL$, INSTALL_TEST, "FInfoDlgProc", HELP_TESTPAGE, "FHelpDlgProc")
if sz$ = BTN_YES$ then
DoPrintTestPage
UIPop 1
goto Dlg_Confirm_Test
elseif sz$ = BTN_NO$ then
UIPop 1
goto CLEANUP
elseif sz$ = BTN_EXIT$ or sz$ = BTN_CANCEL$ then
doASKQUIT
end if
goto Dlg_Install_Test
Dlg_Confirm_Test:
FInitMultiDialog
SetSymbolValue SYM_RESOURCEBASENAME$, VAL_STATUSPAGE$
Dlg_Confirm_Test_Loop:
sz$ = UIStartDlg(DLL_CUIDLL$, EXPLAIN_PAGE, "FMultiDlgProc", HELP_EXPLAIN_PAGE, "FHelpDlgProc")
if sz$ = BTN_OK$ then
UIPop 1
goto CLEANUP
elseif sz$ = BTN_PRINTAGAIN$ then
hwnd% = val(GetSymbolValue(SYM_CURDLGHANDLE$))
hwnd% = GetDlgItem (hwnd%,402)
EnableWindow hwnd%, FALSE
DoPrintTestPage
EnableWindow hwnd%, TRUE
elseif sz$ = BTN_EXIT$ or sz$ = BTN_CANCEL$ then
doASKQUIT
end if
goto Dlg_Confirm_Test_Loop
CLEANUP:
QUIT:
ON ERROR GOTO ERRQUIT
FCLEANUP
FEnableControls TRUE
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
END
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
IF dlg% = EXITSUCCESS THEN
iHelp% = HELP_EXITSUCCESS
ELSE
iHelp% = HELP_EXITFAILURE
END IF
sz$ = UIStartDlg(DLL_CUIDLL$, dlg%, "FInfo0DlgProc", iHelp%, "FHelpDlgProc")
IF sz$ = VAL_REACTIVE$ THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
sz$ = UIStartDlg(DLL_CUIDLL$, EXITFAILURE, "FInfo0DlgProc", HELP_EXITFAILURE, "FHelpDlgProc")
END
SUB BuildPrinterName () STATIC
sz$ = GetIniKeyString (INI_WININI, INI_WINDOWS, INI_DEVICE$)
if UCASE$(mid$(sz$, 1, 20)) <> UCASE$(MSG_WPS$) then
iModel = 0
else
szPort$ = mid$(sz$, instr(UCASE$(sz$), ",WPSLA,")+len(",WPSLA,"))
IF OEM_NAME$ <> "" THEN
szPortSect$ = OEM_NAME + "," + szPort$
END IF
WinDir$ = string$(145, 32)
i% = GetWindowsDirectory (WinDir$, 145)
IF i% <> 0 THEN
iModel = VAL(GetIniKeyString (WinDir$+"\"+FILE_WPSINI$, szPortSect$, INI_MODEL$))
ELSE
iModel = 0
END IF
end if
END SUB
SUB DoPrintTestPage () STATIC
FEnableControls FALSE
j% = HShowWaitCursor
PrintTestPage val(GetSymbolValue(SYM_CURDLGHANDLE$)), iModel, szPort$
i% = FRestoreCursor (j%)
FEnableControls TRUE
END SUB
SUB doASKQUIT STATIC
FEnableControls FALSE
sz$ = UIStartDlg(DLL_CUIDLL$, ASKQUIT, "FQuitDlgProc", HELP_ASKQUIT, "FHelpDlgProc")
IF sz$ = BTN_EXITINSTALL$ THEN
UIPop 65535
FCLEANUP
END
ELSE
UIPop 1
END IF
FEnableControls TRUE
END SUB
SUB Box (message$, title$) STATIC
i% = DoMsgBox (message$, title$, 1)
if i% = 2 then
doASKQUIT
end if
END SUB
SUB UIPop (n%) STATIC
IF FKillNDialogs(n%) = 0 THEN
ERROR STFERR
END IF
END SUB
SUB FCLEANUP () STATIC
CursorSave% = HShowWaitCursor
FRemoveValFromIniKey INI_WININI$, INI_WINDOWS$, INI_RUN$, INI_TESTPAGE$
WinDir$ = string$(145, 32)
i% = GetWindowsDirectory (WinDir$, 145)
IF i% <> 0 THEN
szDir$ = WinDir$ + "\" + PATH_TESTPAGE$
IF FDirExists(szDir$) <> 0 THEN
DeleteDir szDir$
END IF
szDir$ = mid$(WinDir$, 1, 3)+PATH_WPS$
IF FDirExists(szDir$) <> 0 THEN
DeleteDir szDir$
END IF
END IF
szDir$ = ""
i% = FRestoreCursor (CursorSave%)
END SUB
SUB DeleteDir(szDir$) STATIC
CLEARLIST
SETFILE szDir$+"\*.*", ON
FOR FileName$ IN FILELIST
junk% = YnrcRemoveFile(FileName$, 256)
NEXT
IF Mid$(GetSymbolValue (SYM_CWDDIR$), 1, 1) <> Mid$(szDir$, 1, 1) THEN
ChDir Mid$(szDir$, 1, 2) + ".."
END IF
RmDir szDir$
FileName$ = ""
END SUB
FUNCTION UIStartDlg(szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) STATIC AS STRING
IF FDoDialog(HwndFrame(), szDll$, Dlg%, szDlgProc$, HelpDlg%, szHelpProc$) = 0 THEN
ERROR STFERR
ELSE
UIStartDlg = GetSymbolValue(SYM_DLGEVENT$)
END IF
END FUNCTION
FUNCTION GetSymbolValue(szSymbol$) STATIC AS STRING
szValue$ = string$(cbSymValMax,32)
Length% = CbGetSymbolValue(szSymbol$, szValue$, cbSymValMax)
GetSymbolValue = szValue$
IF szSymbol$ = "" THEN
ERROR STFERR
END IF
szValue$ = ""
END FUNCTION
FUNCTION GetIniKeyString (szFile$, szSect$, szKey$) STATIC AS STRING
cb% = 512
szBuf$ = STRING$(cb%, 32)
cbRet% = CbGetIniKeyString(szFile$, szSect$, szKey$, szBuf$, cb%)
GetIniKeyString = szBuf$
szBuf$ = ""
END FUNCTION
FUNCTION GetListItem(szListSymbol$, nItem%) STATIC AS STRING
szListItem$ = string$(cbSymValMax,32)
Length% = CbGetListItem(szListSymbol$, nItem%, szListItem$, cbSymValMax)
GetListItem = szListItem$
IF szListSymbol$ = "" THEN
ERROR STFERR
END IF
szListItem$ = ""
END FUNCTION
FUNCTION GetListLength(szSymbol$) STATIC AS INTEGER
GetListLength = UsGetListLength(szSymbol$)
IF szSymbol$ = "" THEN
ERROR STFERR
END IF
END FUNCTION
SUB SetSymbolValue(szSymbol$, szValue$) STATIC
IF FSetSymbolValue(szSymbol$, szValue$) = 0 THEN
ERROR STFERR
END IF
END SUB
FUNCTION InitSetup(szCmdLine$) STATIC AS INTEGER
fFrameInit = 0
fInstallInit = 0
IF hSetup > 0 THEN
ERROR STFERR
END IF
i% = InitializeFrame(szCmdLine$)
IF i% = -1 THEN
END
ELSEIF i% = 0 THEN
ERROR STFERR
END
ELSE
InitFrame = i%
END IF
fFrameInit = 1
IF FInitializeInstall(HinstFrame(), HwndFrame()) = 0 THEN
ERROR STFERR
END
END IF
fInstallInit = 1
InitSetup = i%
END FUNCTION